package com.wonderful.eyepetizer.data.http

import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

/**
 * Desc:
 * @Author: wonderful
 * @Time: 2024/1/23 15:10
 */
object ServiceCreator {

    private const val BASE_URL = "http://baobab.kaiyanapp.com/api/"

    private val retrofit by lazy {
        Retrofit.Builder()
            .baseUrl(BASE_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .build()
    }

    fun <T> create(serviceClass: Class<T>): T = retrofit.create(serviceClass)

    inline fun <reified T> create(): T = create(T::class.java)
}